import java.util.List;

/**
 * @author SaoE
 * @date 2025/3/3 17:19
 */
public class _139 {
    public boolean wordBreak(String s, List<String> wordDict) {
        int len = s.length();
        boolean[] dp = new boolean[len + 1];
        dp[0] = true;
        for (int i = 0; i <= len; i++){
            for (int j = 0; j < i; j++){
                for (String str : wordDict){
                    if(s.substring(j, i).equals(str) && dp[j]==true){
                        dp[i] = true;
//                        break;
                    }
                }
            }
        }
        return dp[len];
    }
}
